package org.fireflow2.designer.eclipse.properties.tab;

import org.eclipse.gef.editparts.AbstractEditPart;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.fireflow2.designer.eclipse.modelwrapper.ModelWrapper;

public class TitleProvider extends LabelProvider {
	public String getText(Object element) {
//		EventListener listener = (EventListener) element;
//		return listener.getClassName();

		StructuredSelection selection = (StructuredSelection)element;
		AbstractEditPart editPart = (AbstractEditPart)selection.getFirstElement();
		if (editPart.getModel() instanceof ModelWrapper){
			ModelWrapper modelWrapper = (ModelWrapper)editPart.getModel();
			String displayName = modelWrapper.getDisplayName();
			String name = modelWrapper.getName();
			return modelWrapper.getElementType()+"--"+((displayName==null||displayName.equals(""))?name:displayName);

		}else{
			return "属性编辑";
		}
	}
}
